package com.wheesper.www.WheesperServer.Services;

import com.wheesper.www.WheesperServer.Net.Session.IOSession;
import ProtocolBuffer.ProtoMessageOuterClass.GroupCreateApplyRequest;
import ProtocolBuffer.ProtoMessageOuterClass.GroupParticipateInApplyRequest;
import ProtocolBuffer.ProtoMessageOuterClass.*;

public class GroupServices {
	//建立群组
	public static void handle(IOSession session,GroupCreateApplyRequest request) {
		String creator_email = request.getCreatorEmail();
		String group_name = request.getGroupIntro();
		String group_intro = request.getGroupIntro();
		GroupController.Instance().creatingGroup(session, creator_email, group_name, group_intro);
	}
	//申请入群
	public static void handle(IOSession session,GroupParticipateInApplyRequest request) {
		GroupController.Instance().applyingParticipateInGroup(session, request);
	}
	//入群申请
	public static void handle(IOSession session,GroupParticipateInReplyRequest request) {
		GroupController.Instance().replyingParticipateInGroup(session, request);
	}
	//通过某种方式查询群组
	public static void handle(IOSession session,GroupSearchRequest request) {
		String group_name = request.getGroupName();
		GroupController.Instance().groupSearching(session, group_name);
	}
	//查询相应的群组列表
	public static void handle(IOSession session,GroupListRequest request) {
		String email = request.getUserEmail();
		GroupController.Instance().queryGroups(session, email);
	}
}
